<!DOCTYPE html>
<?php
	function verMas($cadena,$cantidad){
		if(strlen($cadena) > $cantidad)
			return substr($cadena,0,$cantidad)."...";
		else
			return $cadena;
	}
?>
<html>
<?php include("admin/head.php")?>
<body>
	<div class="container">
		<a class="brand" href="<?php echo base_url(). "index.php/principal" ?>" name="top"><img style="margin: 6px auto" src="<?php echo base_url('application/views/img/logo.png') ?>" alt="Image" style="max-width:100%;" /></a>


<?php
if($session_user!=NULL){
echo"

<a  class=\"btn btn-mini pull-right\"  href=\"". base_url('index.php/admin/logout')."\">
					<i class=\"icon-off\"></i> Cerrar sesión
					</a>";
}
?>
<a  class="btn btn-mini pull-right"  href="<?php echo base_url('index.php/admin/') ?>">
					<i class="icon-user"></i>Administración
					</a>

		<?php include("navbaruser.php")?>


<h3>Películas</h3>
		<div class="">
			<?php
				
			
				for($i=0;$i<count($result);$i++){
				echo "<div class=\"row-fluid\">
				<div class=\"well span6\">
					<div class=\"span3\">
						<a href=\"".base_url()."index.php/VerPelicula/index/".$result[$i]->id."\"><img src=\"".base_url()."poster/".$result[$i]->rutaPoster."\" alt=\"\" /></img></a>
					</div>
					<div class=\"span9\">
						<a href=\"".base_url()."index.php/VerPelicula/index/".$result[$i]->id."\"><h4>".$result[$i]->titulo." <em>(".$result[$i]->anyo.")</em></h4></a><a class=\"hrefGenero\" href=\"".base_url()."index.php/principal/ListarPeliculaGenero/".$result[$i]->genero."\"><span class=\"label label-info\">".$result[$i]->genero."</span></a>
						<p>".verMas($result[$i]->sinopsis,45)."</p>
					</div>
				</div>";
				}
				
				if($i==0) echo "<div class=\"alert alert-error\">No hay peliculas para mostrar...</div>";
			
			?>
			<!--

			<div class="pagination btn-group">
				<button class="btn"><a href="#">&laquo;</a></button>
				<button class="btn"><a href="#">1</a></button>
				<button class="btn btn-primary disabled">2</button>
				<button class="btn"><a href="#">3</a></button>
				<button class="btn"><a href="#">4</a></button>
				<button class="btn"><a href="#">&raquo;</a></button>
			</div>
	-->		
		</div>
<?php echo $this->pagination->create_links();?>
			<?php include("admin/footer.php")?>
	</div>
	
	<?php include("admin/scripts.php")?>

  </body>
</html>
